<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="">
		<meta name="author" content="">
		<title>订单详情</title>
		<link rel="stylesheet" href="../../css/base.css" />
		<link rel="stylesheet" href="../../css/common.css" />
		<!-- Bootstrap Core CSS -->
		<link href="../../sbadmin/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
		<!-- MetisMenu CSS -->
		<link href="../../sbadmin/bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">
		<!-- DataTables CSS -->
		<link href="../../sbadmin/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet">
		<!-- Custom CSS -->
		<link href="../../sbadmin/dist/css/sb-admin-2.css" rel="stylesheet">
		<!-- Custom Fonts -->
		<link href="../../sbadmin/bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
	<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
	<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
	<![endif]-->
		<style>
			body {
				padding: 0 15px !important;
			}
		</style>
	</head>

	<body style="background:#FFF;">
		<div class="comm-tt-font pr">
			会员信息 > 会员详情 > 订单详情
		</div>
		<div class="zl-ccbox">
			<div class="zl-cctt">
				<ul class="zl-list-ul clb">
					<li>
						<a href="personalMsg.html">个人资料</a>
					</li>
					<li>
						<a href="babyMsg.html">宝宝资料</a>
					</li>
					<li>
						<a href="order.html" class="cur">订单</a>
					</li>
				</ul>
			</div>
		</div>
		<div class="order-detail clb">
			<div class="fl od-imgbox">
				<img src="" id="odImg">
			</div>
			<div class="fl ml20">
				<div class="clb">
					<div class="od-name fl" id="odName">商品商品名</div>
					<div class="ml20 fl" style="height: 30px;line-height: 30px;">使用日期：<span id="syrq"></span></div>
				</div>
				<div>商品编号：<span id="spbh"></span></div>
				<div class="od-price mt5">
					<label id="odSprice"></label>
					<span id="odGprice" class="ml10"></span>
				</div>
				<div class="clb">
					<div class="fl ft-ttbox">
						<div class="ft-ttace">商品分类</div>
						<div class="ft-ccace" id="odFl"></div>
					</div>
					<div class="fl ft-ttbox">
						<div class="ft-ttace">拍摄次数(次)</div>
						<div class="ft-ccace" id="odPaiNum"></div>
					</div>
					<div class="fl ft-ttbox">
						<div class="ft-ttace">有效期(天)</div>
						<div class="ft-ccace" id="yxDate"></div>
					</div>
				</div>
				<div class="wo-form-item clb mt10">
					<div class="fl">
						<div class="od-form-itemtt fl">拍摄张数：</div>
						<div class="od-form-itemcc fl" id="odPaiZ"></div>
					</div>
					<div class="fl">
						<div class="od-form-itemtt fl">彩妆：</div>
						<div class="od-form-itemcc fl" id="odCz"></div>
					</div>
				</div>
				<div class="wo-form-item clb">
					<div class="fl">
						<div class="od-form-itemtt fl">精修底片：</div>
						<div class="od-form-itemcc fl" id="odJxZs"></div>
					</div>
					<div class="fl">
						<div class="od-form-itemtt fl">摄影师：</div>
						<div class="od-form-itemcc fl" id="odShePerson"></div>
					</div>
				</div>
				<div class="wo-form-item clb">
					<div class="fl">
						<div class="od-form-itemtt fl">服装造型：</div>
						<div class="od-form-itemcc fl" id="odFzNum"></div>
					</div>
					<div class="fl">
						<div class="od-form-itemtt fl">MV拍摄：</div>
						<div class="od-form-itemcc fl" id="odMV"></div>
					</div>
				</div>
				<div class="wo-form-item clb">
					<div class="fl">
						<div class="od-form-itemtt fl">场景数量：</div>
						<div class="od-form-itemcc fl" id="odCj"></div>
					</div>
					<div class="fl">
						<div class="od-form-itemtt fl">拍摄花絮：</div>
						<div class="od-form-itemcc fl" id="odHx"></div>
					</div>
				</div>
				<div class="wo-form-item clb">
					<div class="fl">
						<div class="od-form-itemtt fl">精品相册：</div>
						<div class="od-form-itemcc fl" id="odXc"></div>
					</div>
					<div class="fl">
						<div class="od-form-itemtt fl">拍摄时长：</div>
						<div class="od-form-itemcc fl" id="odSc"></div>
					</div>
				</div>
				<div class="wo-form-item clb">
					<div class="fl">
						<div class="od-form-itemtt fl">电子书：</div>
						<div class="od-form-itemcc fl" id="odDzs"></div>
					</div>
				</div>
			</div>
		</div>

		<div class="bars-box">
			<div class="export">
				<span class="exptxt fl">使用记录</span>
			</div>
			<div class="panel-body" style="padding-top: 0 !important;">
				<div class="dataTable_wrapper" id="app">
					<table class="table table-striped table-bordered table-hover" id="dataTables-example">
						<thead>
							<tr>
								<th>核销号</th>
								<th>消费次数</th>
								<th>消费金额</th>
								<th>消费时间</th>
								<th>消费门店</th>
								<th>备注</th>
							</tr>
						</thead>
						<tbody id="list-td">

						</tbody>
					</table>
				</div>
				<!-- /.table-responsive -->
			</div>
			<div class="no-tit">
				<img class="no-pic" src="../../img/error.jpg" />
				<p class="no-txt">没有符合筛选条件的记录</p>
			</div>
		</div>

		<!-- jQuery -->
		<script src="../../sbadmin/bower_components/jquery/dist/jquery.min.js"></script>
		<!-- Bootstrap Core JavaScript -->
		<script src="../../sbadmin/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<!-- Metis Menu Plugin JavaScript -->
		<script src="../../sbadmin/bower_components/metisMenu/dist/metisMenu.min.js"></script>
		<!-- DataTables JavaScript -->
		<script src="../../sbadmin/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
		<script src="../../sbadmin/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>
		<!-- Custom Theme JavaScript -->
		<script src="../../sbadmin/dist/js/sb-admin-2.js"></script>
		<!-- Page-Level Demo Scripts - Tables - Use for reference -->
	</body>
	<script>
		var odetailskuId = localStorage.getItem("odetailskuId");
		var orderImg = localStorage.getItem("orderImg");
		var skuid = localStorage.getItem("skuid");
		var odStoreName = localStorage.getItem("odStoreName");
		$("#odImg").attr("src", orderImg);
		var post_data = {
			"id": skuid
		}
		$.ajax({
			url: "https://order.wz1996.wang/wzbg/sku/query",
			type: 'post',
			contentType: 'application/json',
			data: JSON.stringify(post_data),
			beforeSend: function(request) {
				request.setRequestHeader("token", localStorage.getItem("token"));
			},
			success: function(data) {
				console.log(data)
				if(data.code == "1") {
					$("#odDzs").html(data.data[0].ebook + " 个");
					$("#odSc").html(data.data[0].takeDuration + " 小时/次");
					$("#odHx").html(data.data[0].takeInteresting + " 个");
					$("#odMV").html(data.data[0].mvTakeTimes + " 个");
					$("#odCz").html(data.data[0].isMakeUp + " 次");
					$("#spbh").html(data.data[0].code);
					$("#odName").html(data.data[0].name);
					$("#odSprice").html("¥" + data.data[0].salePrice);
					$("#odGprice").html("指导价：¥" + data.data[0].guidePrice);
					var odFL = data.data[0].categoryId;
					var odFlName = "";
					if(odFL == "2") {
						odFlName = "儿童摄影"
					} else if(odFL == "3") {
						odFlName = "成人摄影"
					} else if(odFL == "4") {
						odFlName = "孕妇照"
					} else if(odFL == "5") {
						odFlName = "全家福"
					}
					$("#odFl").html(odFlName); //分类
					$("#odCj").html(data.data[0].pageCount + " 个/次"); //场景数量
					$("#odShop").html(odStoreName); //门店,从上个页面带来
					$("#odXc").html(data.data[0].albumCount + " 本"); //相册
					$("#odPaiNum").html(data.data[0].takeTimes); //拍摄次数
					$("#odShePerson").html(data.data[0].cameraman); //摄影师
					$("#odPaiZ").html(data.data[0].pageCount + " 张"); //拍摄张数
					$("#odFzNum").html(data.data[0].clothingCount + " 次"); //服装数量
					$("#odJxZs").html(data.data[0].psCount + " 张"); //精修张数
				} else if(data.code == "-1") {
					layar(data.msg);
					setTimeout("window.parent.frames.location.href='/xcxadmin/login.html'", 1000)
				} else {
					layar(data.msg);
				}
			},
			error: function(e) {
				errcode(e);
			}
		});
		getList(odetailskuId);

		function getList(id) {
			$("#dataTables-example").dataTable().fnDestroy();
			var post_data = {
				"orderDetailId": id
			}
			$.ajax({
				url: "https://order.wz1996.wang/wzbg/checkrecord/query",
				type: 'post',
				contentType: 'application/json',
				data: JSON.stringify(post_data),
				beforeSend: function(request) {
					request.setRequestHeader("token", localStorage.getItem("token"));
				},
				success: function(data) {
					console.log(data);
					if(data.code == 1) {
						var html = "";
						for(var i = 0; i < data.data.checkRecord.length; i++) {
							if(data.data.checkRecord[i].title == "购买") {
								$("#syrq").html(data.data.checkRecord[i].checkDaytime.split(" ")[0] + " - " + data.data.checkRecord[i].expiredDaytime.split(" ")[0]);
								var lxclassStart = data.data.checkRecord[i].checkDaytime.split(" ")[0];
								var lxclassend = data.data.checkRecord[i].expiredDaytime.split(" ")[0];
								var date1 = new Date((lxclassStart.replace(/-/g, "/")));
								var date2 = new Date((lxclassend.replace(/-/g, "/")));
								$("#yxDate").html((parseInt(date2 - date1) / (24 * 3600 * 1000)));
							} else {
								html += "<tr class='odd gradeX'>";
								html += "<td>" + data.data.checkRecord[i].id + "</td>";
								var xfNum = Number(data.data.checkRecord[i].totalCount) - Number(data.data.checkRecord[i].leftCount)
								html += "<td>" + xfNum + "</td>";
								html += "<td>" + data.data.checkRecord[i].perPrice + "</td>";
								html += "<td>" + data.data.checkRecord[i].checkDaytime + "</td>";
								html += "<td>" + data.data.checkRecord[i].storeName + "</td>";
								if(data.data.checkRecord[i].remark == null) {
									html += "<td>--</td>";
								} else {
									html += "<td>" + data.data.checkRecord[i].remark + "</td>";
								}
								html += "</tr>";
							}
						}
						$("#list-td").html(html);
						$('#dataTables-example').DataTable({
							responsive: false,
							bLengthChange: false,
							bSort: true,
							paging: true,
							bFilter: true,
							searching: false,
							bInfo: true,
							bAutoWidth: true,
							"oLanguage": {
								"sLengthMenu": "每页显示 _MENU_ 条记录",
								"sZeroRecords": "抱歉， 没有找到",
								"sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
								"sInfoEmpty": "没有数据",
								"sInfoFiltered": "(从 _MAX_ 条数据中检索)",
								"oPaginate": {
									"sFirst": "首页",
									"sPrevious": "前一页",
									"sNext": "后一页",
									"sLast": "尾页"
								},
								"sSearch": "查询条件:",
								"sZeroRecords": "没有检索到数据",
								"sProcessing": "<img src='./loading.gif' />"
							}
						});
					} else if(data.code == "-1") {
						layar(data.msg);
						setTimeout("window.parent.frames.location.href='/xcxadmin/login.html'", 1000)
					} else {
						layar(data.msg);
					}

				},
				error: function(e) {
					errcode(e);
				}
			});

		}
	</script>

</html>